/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.tspp.dao.dto;

import java.io.Serializable;

/**
 * Transfer object for Entrant table(DAO pattern)
 * @author Maks
 */
public class Entrant implements Serializable {

    /** This attribute maps to the column ID_ENTRANT in the ENTRANT table.*/
    private int idEntrant;

    /** This attribute maps to the column ID_GROUP in the ENTRANT table.*/
    private int idGroup;

    /** This attribute maps to the column NAME in the ENTRANT table.*/
    private String name;

    /** This attribute maps to the column SURNAME in the ENTRANT table.*/
    private String surname;

    /** This attribute maps to the column ADDRESS in the ENTRANT table.*/
    private String address;

    /**
     * Return value of the column ID_ENTRANT in the ENTRANT table
     * @return int id of entrant in the entrant table
     */
    public int getIdEntrant() {
        return idEntrant;
    }

    /**
     * Set the id of entrant
     * @param idEntrant
     */
    public void setIdEntrant(int idEntrant) {
        this.idEntrant = idEntrant;
    }

    /**
     * Return value of the column ID_GROUP in the ENTRANT table
     * @return int id of the group of current entrant or -1 if entrant has no group
     */
    public int getIdGroup() {
        return idGroup;
    }

    /**
     * Set the value of group id
     * @param idGroup if entrant has no group then -1 is setted
     */
    public void setIdGroup(int idGroup) {
        this.idGroup = idGroup;
    }


    /**
     * Return value of the column NAME in the ENTRANT table
     * @return String name of entrant
     */
    public String getName() {
        return name;
    }

    /**
     * Set the name of entrant
     * @param name entrant's name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Return value of the column SURNAME in the ENTRANT table
     * @return String surname of entrant
     */
    public String getSurname() {
        return surname;
    }

    /**
     * Set the surname of entrant
     * @param surname entrant's surname
     */
    public void setSurname(String surname) {
        this.surname = surname;
    }

    /**
     * Return value of the column ADDRESS in the ENTRANT table
     * @return String address of entrant
     */
    public String getAddress() {
        return address;
    }

    /**
     * Set the address of entrant
     * @param address entrant's address
     */
    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * Method 'equals'
     *
     * @param _other
     * @return boolean
     */
    @Override
    public boolean equals(Object _other) {
        if (_other == null) {
            return false;
        }

        if (_other == this) {
            return true;
        }

        if (!(_other instanceof Entrant)) {
            return false;
        }

        final Entrant _cast = (Entrant) _other;
        if (idEntrant != _cast.idEntrant) {
            return false;
        }

        if (idGroup != _cast.idGroup) {
            return false;
        }

        if (name == null ? !_cast.name.equals(name) : !name.equals(_cast.name)) {
            return false;
        }

        if (surname == null ? !_cast.surname.equals(surname) : !surname.equals(_cast.surname)) {
            return false;
        }

        if (address == null ? !_cast.address.equals(address) : !address.equals(_cast.address)) {
            return false;
        }
        return true;
    }

    /**
     * Method 'hashCode'
     *
     * @return int
     */
    @Override
    public int hashCode() {
        int _hashCode = 0;
        _hashCode = 29 * _hashCode + idEntrant;
        _hashCode = 29 * _hashCode + idGroup;
        if (name != null) {
            _hashCode = 29 * _hashCode + name.hashCode();
        }

        if (surname != null) {
            _hashCode = 29 * _hashCode + surname.hashCode();
        }

        if (address != null) {
            _hashCode = 29 * _hashCode + address.hashCode();
        }

        return _hashCode;
    }

    /**
     * Method 'toString'
     *
     * @return String
     */
    @Override
    public String toString() {
        StringBuilder ret = new StringBuilder();
        ret.append("com.tspp.dao.dto.Entrant: ");
        ret.append("idEntrant=").append(idEntrant);
        ret.append(", idGroup=").append(idGroup);
        ret.append(", name=").append(name);
        ret.append(", surname=").append(surname);
        ret.append(", address=").append(address);
        return ret.toString();
    }
}
